/*
 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION!

import { int32, float32 } from "@koalaui/common"
import { KStringPtr, KBoolean, RuntimeType, runtimeType, isResource, isInstanceOf } from "@koalaui/interop"
import { NodeAttach, remember } from "@koalaui/runtime"
import { ComponentBase } from "./ComponentBase"
import { TypeChecker } from "#components"
import { ArkCommonMethodComponent } from "./ArkCommon"
import { ArkDividerPeer } from "./peers/ArkDividerPeer"
import { CommonMethod } from "./ArkCommonInterfaces"
import { DividerAttribute } from "./ArkDividerInterfaces"
import { ResourceColor } from "./ArkUnitsInterfaces"
import { LineCapStyle } from "./ArkEnumsInterfaces"
/** @memo:stable */
export class ArkDividerComponent extends ArkCommonMethodComponent {
    getPeer(): ArkDividerPeer {
        return (this.peer as ArkDividerPeer)
    }
    /** @memo */
    public setDividerOptions(): this {
        if (this.checkPriority("setDividerOptions")) {
            this.getPeer()?.setDividerOptionsAttribute()
            return this
        }
        return this
    }
    /** @memo */
    public vertical(value: boolean): this {
        if (this.checkPriority("vertical")) {
            const value_casted = value as (boolean)
            this.getPeer()?.verticalAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public color(value: ResourceColor): this {
        if (this.checkPriority("color")) {
            const value_casted = value as (ResourceColor)
            this.getPeer()?.colorAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public strokeWidth(value: number | string): this {
        if (this.checkPriority("strokeWidth")) {
            const value_casted = value as (number | string)
            this.getPeer()?.strokeWidthAttribute(value_casted)
            return this
        }
        return this
    }
    /** @memo */
    public lineCap(value: LineCapStyle): this {
        if (this.checkPriority("lineCap")) {
            const value_casted = value as (LineCapStyle)
            this.getPeer()?.lineCapAttribute(value_casted)
            return this
        }
        return this
    }
    public applyAttributesFinish(): void {
        // we calls this function outside of class, so need to make it public
        super.applyAttributesFinish()
    }
}

/** @memo */
export function ArkDivider(
  /** @memo */
  style: ((attributes: ArkDividerComponent) => void) | undefined,
  /** @memo */
  content_: (() => void) | undefined,
  
) {
    const receiver = remember(() => {
        return new ArkDividerComponent()
    })
    NodeAttach<ArkDividerPeer>((): ArkDividerPeer => ArkDividerPeer.create(receiver), (_: ArkDividerPeer) => {
        receiver.setDividerOptions()
        style?.(receiver)
        content_?.()
        receiver.applyAttributesFinish()
    })
}
